package jdbc;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.Statement;

public class InsertOralce {
	public static void main(String[] args) {
		 try {
			 Connection conn = null;
			  Class.forName("oracle.jdbc.driver.OracleDriver");//加入oracle的驱动，“”里面是驱动的路径
			  String url = "jdbc:oracle:thin:@192.168.1.141:1521:orcl";// 数据库连接，oracle代表链
			  conn = DriverManager.getConnection(url, "hbb_demp","hbb_demp" );
			  String sql = "insert into student(name,sex,address) values('chewl','chewl','chewl')";
			  Statement st = conn.createStatement();
			  st.executeUpdate(sql);
			  conn.commit();
			  st.close();
			  conn.close();
		} catch (Exception e) {
			e.printStackTrace();
		}//数据库驱动
	}
}
